﻿using System;
using System.Linq;
using Orange.Logistics.Models;
using Orange.Logistics.Infrastructure;
using Orange.Logistics.Services;
using System.Web.Mvc;
using Newtonsoft.Json;
using System.Collections.Generic;

namespace Orange.Logistics.Controllers {

    public class StockController : BaseController<Stock> {

        private readonly IStockService service;

        public StockController(IStockService service)
            : base(service) {
            this.service = service;
        }

        protected override Func<Stock, object> GetOrderBy(string sort) {
            return s => {
                switch (sort) {
                    case "Customername":
                        return s.Customername;
                    case "Memorycard":
                        return s.Memorycard;
                    case "Proname":
                        return s.Proname;
                    case "Brandname":
                        return s.Brandname;
                    case "Moname":
                        return s.Moname;
                    case "Maname":
                        return s.Maname;
                    case "Weight":
                        return s.Weight;
                    case "Carno":
                        return s.Carno;
                    case "Status":
                        return s.Status;
                    default:
                        return s.Did;
                }
            };
        }

        public ActionResult FilterCustomer() {
            return View();
        }

        protected override void Dispose(bool disposing) {
            if (disposing) {
                service.Dispose();
            }
        }
    }
}
